package com.design.yjx.templatemethod;

import java.util.Scanner;

/**
 * @author yuanjianxin
 * @date 2017/8/22 11:15
 */
public class Tea extends CaffeineBeverage {
    @Override
    void brew() {
        System.out.println("浸泡茶");
    }

    @Override
    void addCondiments() {
        System.out.println("加入柠檬");
    }

    @Override
    public boolean isAddCondiment() {
        if (getUserInfo().equals("y")) {
            return true;
        } else {
            return false;
        }
    }

    public String getUserInfo() {
        Scanner scanner = new Scanner(System.in);
        System.out.println("是否需要加入调味料(y/n)：");
        return scanner.nextLine();
    }
}
